`include "PRV564Config.v"
`include "PRV564Define.v"

module TableEntry(
    input wire              GLB_CLKi,
    input wire              GLB_SRSTi,
//-----------------------Access Table write port-----------------
    input wire              Tablei_WREN,
    input wire [7:0]        Tablei_WID,
    input wire [`XLEN-1:0]  Tablei_ADDR,
    input wire [`XLEN-1:0]  Tablei_PC,
    input wire [7:0]        Tablei_ITAG,
    input wire [1:0]        Tablei_priv,
    input wire [7:0]        Tablei_opcode,
    input wire [1:0]        Tablei_opinfo,
    input wire [3:0]        Tablei_opsize,
    input wire              Tablei_ci,
    input wire              Tablei_InstPageFlt,
    input wire              Tablei_LoadPageFlt,
    input wire              Tablei_StorePageFlt,
    input wire              Tablei_InstAddrmis,
    input wire              Tablei_LoadAddrMis,
    input wire              Tablei_StoreAddrMis,	
//--------------------Access Table read port----------------------
    input wire              Tablei_Remove,
    output reg              Tableo_V,
    output reg [`XLEN-1:0]  Tableo_ADDR,
    output reg [`XLEN-1:0]  Tableo_PC,
    output reg [7:0]        Tableo_RID,
    output reg [7:0]        Tableo_ITAG,
    output reg [1:0]        Tableo_priv,
    output reg [7:0]        Tableo_opcode,
    output reg [1:0]        Tableo_opinfo,
    output reg [3:0]        Tableo_opsize,
    output reg              Tableo_ci,
    output reg              Tableo_InstPageFlt,
    output reg              Tableo_LoadPageFlt,
    output reg              Tableo_StorePageFlt,
    output reg              Tableo_InstAddrmis,
    output reg              Tableo_LoadAddrMis,
    output reg              Tableo_StoreAddrMis		
);

always@(posedge GLB_CLKi)begin
    if(GLB_SRSTi)begin
        Tableo_V            <= 1'b0;
    end
    else if(Tablei_WREN)begin
        Tableo_V            <= 1'b1;
        Tableo_ADDR         <= Tablei_ADDR;
        Tableo_PC           <= Tablei_PC;
        Tableo_RID          <= Tablei_WID;
        Tableo_ITAG         <= Tablei_ITAG;
        Tableo_priv         <= Tablei_priv;
        Tableo_opcode       <= Tablei_opcode;
        Tableo_opinfo       <= Tablei_opinfo;
        Tableo_opsize       <= Tablei_opsize;
        Tableo_ci           <= Tablei_ci;
        Tableo_InstPageFlt  <= Tablei_InstPageFlt;
        Tableo_LoadPageFlt  <= Tablei_LoadPageFlt;
        Tableo_StorePageFlt <= Tablei_StorePageFlt;
        Tableo_InstAddrmis  <= Tablei_InstAddrmis;
        Tableo_LoadAddrMis  <= Tablei_LoadAddrMis;
        Tableo_StoreAddrMis <= Tablei_StoreAddrMis;		
    end
    else if(Tablei_Remove)begin
        Tableo_V            <= 1'b0;
    end
end

endmodule